<%@ page import="java.io.*" %>
<%@ page import="com.googlecode.jwsm.*" %>
<%
String[] parse = null;
String[] jarName = null;
String[] fileName = null;
File[] files = null;
String[][] dependencies = null;
int[] classCount = null;
if (request.getParameter("jars") != null) {
	parse = request.getParameter("jars").split("\\|");
	jarName = new String[parse.length - 1];
	fileName = new String[parse.length - 1];
	files = new File[parse.length - 1];
	dependencies = new String[parse.length - 1][];
	classCount = new int[parse.length - 1];
	for (int i = 1; i < parse.length; i++) {
		String[] split = parse[i].split(":");
		jarName[i - 1] = split[0];
		fileName[i - 1] = split[1];
		files[i - 1] = new File(Uploader.directory, fileName[i - 1]);
		dependencies[i - 1] = JarClassLoader.dependencyDuplicationCheck(files[i - 1], Thread.currentThread().getContextClassLoader());
		classCount[i - 1] = JarClassLoader.getClassCount(files[i - 1]);
	}
}
%>
<html>
<head>
<title>Dependency Duplication Check - Java Web Service Manager</title>
<%@ include file="css.jsp" %>
<style type="text/css">
	body {
		margin: 0px;
		font-family: sans-serif;
	}
	
	.menu {
		font-size: 10pt;
		font-weight: bold;
		color: white;
		text-decoration: none;
	}
	
	.menu:hover {
		text-decoration: underline;
	}
	
	.table {
		border: 1px solid #000000;
	}
</style>
</head>
<body>
<table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="<%= CSSDefaults.BG_COLOR %>">
<tr><td style="font-size: 16pt; font-weight: bold; color: white;">Dependency Duplication Check</td></tr>
</table>
<br/>
<% if (request.getParameter("jars") != null) { %>
	&#160;<b>Dependencies Duplicated in Parent ClassLoader:</b>
	<ul>
	<% for (int i = 0; i < jarName.length; i++) {%>
		<li><%= jarName[i] %> (<%= dependencies[i].length %> of <%= classCount[i] %>)</li>
		<% if (dependencies[i].length > 0) { %><ul><% } %>
		<% for (int j = 0; j < dependencies[i].length; j++) { %>
			<li><%= dependencies[i][j] %></li>
		<% } %>
		<% if (dependencies[i].length > 0) { %></ul><% } %>
	<% } %>
	</ul>
<% } %>
</body>
</html>